<?php

/**
 *  Defines THIS_PAGE_URL
 *  All values must have no trailing slash!
 *   
 */  

global $gCms;

//echo $_SERVER['DOCUMENT_ROOT'].'<br />';
$thisdir = str_replace(DIRECTORY_SEPARATOR, '/', dirname(__FILE__));

$prefix = str_replace($_SERVER['DOCUMENT_ROOT'], '', $thisdir); 
$prefix = str_replace('modules/Antz/Antz', '', $prefix);
$prefix = trim($prefix, '/');

// now we form a dynamic constant that we can use to find the exact url to the current request
$requestedPage = ltrim($_SERVER['REQUEST_URI'], '/'); 
if(substr($requestedPage, 0, strlen($prefix))==$prefix) $requestedPage = substr($requestedPage, strlen($prefix));

define('THIS_PAGE_URL', trim($gCms->config['root_url'].'/'.trim($requestedPage, '/'), '/'));

